package errpackage

import (
	"fmt"
	"os"
	"strconv"
)

func test1() {
	str1 := "123"
	num, _ := strconv.Atoi(str1)
	fmt.Println(num)
}

func test2() {
	str1 := "abc"
	num, _ := strconv.Atoi(str1)
	fmt.Println(num)
}

func test3(str1 string) {
	num1, err1 := strconv.Atoi(str1)
	if err1 != nil {
		fmt.Println("error!", err1)
		os.Exit(2)
	}
	fmt.Println(num1)
}

func test4(s ...string) {
	if len(s) == 0 {
		fmt.Println("empty")
		return
	}

	fmt.Println("开始遍历")
	for _, str := range s {
		fmt.Println(str)
	}
	fmt.Println()
}

func test5(s ...string) {
	f1(s...)
	f2(s)
}

func f1(s ...string) {

}

func f2(s []string) {

}

func Test() {
	test4()
	test4("123", "456", "789")
	test4("abc", "bbb")
}
